//go:build wireinject
// +build wireinject

package ioc

import (
	appService "example.com/m/v2/internal/application/service"
	persistence2 "example.com/m/v2/internal/domain/account_aggregate/repository/persistence"
	domainService "example.com/m/v2/internal/domain/account_aggregate/service"
	"example.com/m/v2/internal/infrastructure/config"
	"example.com/m/v2/internal/infrastructure/db/mysql"
	"example.com/m/v2/internal/interfaces/facade"
	"github.com/google/wire"
)

var (
	defaultConfig = config.LoadConfig()
	configSet     = wire.NewSet(wire.Value(defaultConfig))
	dbSet         = wire.NewSet(mysql.InitGorm)
	repoSet       = wire.NewSet(
		persistence2.NewMainAccountRepository,
		persistence2.NewSubAccountRepository,
	)
	domainServiceSet = wire.NewSet(
		domainService.NewAccountDomainService,
	)
	appServiceSet = wire.NewSet(
		appService.NewAccountAppService,
	)
)

func GetAppAccountService() (*appService.AccountAppService, error) {
	wire.Build(
		configSet,
		dbSet,
		repoSet,
		domainServiceSet,
		appServiceSet,
	)
	return nil, nil
}

func GetAccountFacade() (*facade.AccountFacade, error) {
	wire.Build(
		configSet,
		dbSet,
		repoSet,
		domainServiceSet,
		appServiceSet,
		facade.NewAccountFacade,
	)
	return nil, nil
}
